package com.wanxi.util;

import java.text.DecimalFormat;

/**
 * Created by IntelliJ IDEA.
 *
 * @Author : 林子淳
 * @create 2023/3/14 16:46
 */
public class Time {
    public static String getTimeTnterval(long diff) {
        DecimalFormat decimalFormat = new DecimalFormat("00");

//        long diff = currentTime.getTime() - firstTime.getTime();//得到的差值
//        long diff = etime-stime;
        long hours = diff / (60 * 60); //获取时
        long minutes = (diff - hours * ( 60 * 60)) / (60);  //获取分钟
        long s = (diff - hours * 60 * 60 - minutes * 60);//获取秒
        String countTime = "" + decimalFormat.format(hours) + ":" + decimalFormat.format(minutes) + ":" + decimalFormat.format(s);
        return countTime;
    }
}
